﻿using System;
using System.Collections;
using System.ComponentModel;

namespace N2.ComponentModel
{
	public class ContentItemCollectionConverter : CollectionConverter
	{
		public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
		{
			if ((destinationType == typeof(string)) && (value is ICollection)) {
				return "[" + (value as ICollection).Count + "]";
			}

			return base.ConvertTo(context, culture, value, destinationType);
		}
	}
}
